#pragma once
#include <QFrame>
#include <vector>
#include <qbprotocol/include/SSQBModel.h>
#include <QVector>

enum  kDataType : char
{
	data_all,
	data_tkn,
	data_tkn_match
};

//债券详情市场动向成交List
enum MktTableCols {
	col_PrcOther_State = 0,  //类型
	col_PrcOther_Empty,		 //无用列，为与EnumBrokerCompList对齐
	col_PrcOther_BuyName,    //买方
	col_PrcOther_BuyVol,     //买量
	col_PrcOther_Buy,        //买价
	col_PrcOther_Sale,       //卖价
	col_PrcOther_SaleVol,	 //卖量
	col_PrcOther_SaleFill1,
	col_PrcOther_SaleFill2,
	col_PrcOther_Broker,     //Broker
	col_PrcOther_SaleName,   //卖方
	col_PrcOther_Update,     //更新时间
	col_PrcOther_Count
};

class SVirtualTable;
class DetailData;
class DefaultTableModel;
class STableColumnSet;
class STabCtrl;
class DetailQuoteTable : public QFrame
{
	Q_OBJECT
public:
    DetailQuoteTable(QWidget* p, QSharedPointer<DetailData> d, int type = -1);
	kDataType filterType() const { return m_filterType; }
	void setFilterType(kDataType t);

protected slots:
	void onTableViewPosChagned(int pos);//填充数据
	void onMarketStreamDataChanged(QList<int> ids);
	void onMktStreamDealDataChanged(QList<QString> ids);
	void updateDataView();
public slots:
    void onTabClicked(int, bool);

    //void paintEvent(QPaintEvent*) override;

private:
	void updateTable();
	void updateDisplayMktStream();
	void initCols();

protected:
    //STabCtrl* m_tab = nullptr;
	SVirtualTable* m_table = nullptr;
    QSharedPointer<DetailData> m_data = nullptr;
	DefaultTableModel* m_model = nullptr;
	int m_type = -1;
	kDataType	m_filterType = data_all;
	std::vector<xQBMarketStreamUnit_c> m_mktStream;
	STableColumnSet* m_tableSet = nullptr;
	QVector<MktTableCols>	m_cols;
};